package com.baseweb.webadmin.core.util;

/**
 * Created by zx on 2017/6/23.
 */
public class PageUtil {

    private Integer page = 1;//页码
    private Integer pageSize = 20;//条数
    private String orderFiled = "id";//排序字段
    private String orderDir = "DESC";//排序方式

    public PageUtil(Integer page, Integer pageSize, String orderFiled, String orderDir) {
        this.page = page;
        this.pageSize = pageSize;
        this.orderFiled = orderFiled;
        this.orderDir = orderDir;
    }

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public String getOrderFiled() {
        return orderFiled;
    }

    public void setOrderFiled(String orderFiled) {
        this.orderFiled = orderFiled;
    }

    public String getOrderDir() {
        return orderDir;
    }

    public void setOrderDir(String orderDir) {
        this.orderDir = orderDir;
    }

    public Integer getPageStartSize(){
        return page >= 1 ? (page - 1) * pageSize : 0;
    }
}
